class Solution
{
public:
    string solve(string s, string t)
    {
        if (s == "0" || t == "0") return "0";

        int n = s.size(), m = t.size();
        string ans;
        vector<int> res(n + m);

        for (int i = n - 1; i >= 0; i--)
        {
            int r = 0;
            for (int j = m - 1; j >= 0; j--)
            {
                int num = (s[i] - '0') * (t[j] - '0') + r + res[i + j + 1];
                res[i + j + 1] = num % 10;
                r = num / 10;
            }
            res[i] += r;
        }
        int i = 0;
        while (i < n + m && res[i] == 0) i++;
        while (i < n + m)  ans.push_back(res[i++] + '0');
        return ans;
    }
};